<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 400px;
            height: 200px;
            background: yellow;
            position: absolute;
            left: 0;
            top: 0;
        }
        
        span {
            display: block;
            width: 100px;
            height: 100px;
            float: left;
        }
        
        p span:nth-of-type(1) {
            background: red;
        }
        
        p span:nth-of-type(2) {
            background: cyan;
        }
        
        p span:nth-of-type(3) {
            background: green;
        }
        
        p span:nth-of-type(4) {
            background: red;
        }
    </style>
</head>

<body>
    <div id="box" class="box"></div>
    <div id="box2" class="box">
        <p>abc
            <span>111</span>
            <span>222</span>
            <span>333</span>
            <span>444</span>

        </p>
    </div>
    <script>
        var oBox = document.querySelector('.box')

        oBox.onclick = function() {
            var n = 0
            setInterval(function() {
                n++
                oBox.style.left = n + 'px'
            }, 100)
        }
    </script>
</body>

</html>